/*
 * Copyright (c) 2006+ Ingo Oppermann
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#include <math.h>

#include "libmodjpeg.h"
#include "convolve.h"

void mj_convolve(mj_block_t *x, mj_block_t *y, float w, int k, int l) {
    float z[64] = {0, 0, 0, 0, 0, 0, 0, 0,
               0, 0, 0, 0, 0, 0, 0, 0,
               0, 0, 0, 0, 0, 0, 0, 0,
               0, 0, 0, 0, 0, 0, 0, 0,
               0, 0, 0, 0, 0, 0, 0, 0,
               0, 0, 0, 0, 0, 0, 0, 0,
               0, 0, 0, 0, 0, 0, 0, 0,
               0, 0, 0, 0, 0, 0, 0, 0};

    if(w == 0.0) {
        return;
    }

    switch(l) {
        case 0:
            z[ 0] = (2.0 * x[ 0]);
            z[ 1] = (2.0 * x[ 1]);
            z[ 2] = (2.0 * x[ 2]);
            z[ 3] = (2.0 * x[ 3]);
            z[ 4] = (2.0 * x[ 4]);
            z[ 5] = (2.0 * x[ 5]);
            z[ 6] = (2.0 * x[ 6]);
            z[ 7] = (2.0 * x[ 7]);
            z[ 8] = (2.0 * x[ 8]);
            z[ 9] = (2.0 * x[ 9]);
            z[10] = (2.0 * x[10]);
            z[11] = (2.0 * x[11]);
            z[12] = (2.0 * x[12]);
            z[13] = (2.0 * x[13]);
            z[14] = (2.0 * x[14]);
            z[15] = (2.0 * x[15]);
            z[16] = (2.0 * x[16]);
            z[17] = (2.0 * x[17]);
            z[18] = (2.0 * x[18]);
            z[19] = (2.0 * x[19]);
            z[20] = (2.0 * x[20]);
            z[21] = (2.0 * x[21]);
            z[22] = (2.0 * x[22]);
            z[23] = (2.0 * x[23]);
            z[24] = (2.0 * x[24]);
            z[25] = (2.0 * x[25]);
            z[26] = (2.0 * x[26]);
            z[27] = (2.0 * x[27]);
            z[28] = (2.0 * x[28]);
            z[29] = (2.0 * x[29]);
            z[30] = (2.0 * x[30]);
            z[31] = (2.0 * x[31]);
            z[32] = (2.0 * x[32]);
            z[33] = (2.0 * x[33]);
            z[34] = (2.0 * x[34]);
            z[35] = (2.0 * x[35]);
            z[36] = (2.0 * x[36]);
            z[37] = (2.0 * x[37]);
            z[38] = (2.0 * x[38]);
            z[39] = (2.0 * x[39]);
            z[40] = (2.0 * x[40]);
            z[41] = (2.0 * x[41]);
            z[42] = (2.0 * x[42]);
            z[43] = (2.0 * x[43]);
            z[44] = (2.0 * x[44]);
            z[45] = (2.0 * x[45]);
            z[46] = (2.0 * x[46]);
            z[47] = (2.0 * x[47]);
            z[48] = (2.0 * x[48]);
            z[49] = (2.0 * x[49]);
            z[50] = (2.0 * x[50]);
            z[51] = (2.0 * x[51]);
            z[52] = (2.0 * x[52]);
            z[53] = (2.0 * x[53]);
            z[54] = (2.0 * x[54]);
            z[55] = (2.0 * x[55]);
            z[56] = (2.0 * x[56]);
            z[57] = (2.0 * x[57]);
            z[58] = (2.0 * x[58]);
            z[59] = (2.0 * x[59]);
            z[60] = (2.0 * x[60]);
            z[61] = (2.0 * x[61]);
            z[62] = (2.0 * x[62]);
            z[63] = (2.0 * x[63]);
            break;
        case 1:
            z[ 0] = (M_SQRT2 * x[ 1]);
            z[ 1] = (M_SQRT2 * x[ 0]) + x[ 2];
            z[ 2] = x[ 1] + x[ 3];
            z[ 3] = x[ 2] + x[ 4];
            z[ 4] = x[ 3] + x[ 5];
            z[ 5] = x[ 4] + x[ 6];
            z[ 6] = x[ 5] + x[ 7];
            z[ 7] = x[ 6];
            z[ 8] = (M_SQRT2 * x[ 9]);
            z[ 9] = (M_SQRT2 * x[ 8]) + x[10];
            z[10] = x[ 9] + x[11];
            z[11] = x[10] + x[12];
            z[12] = x[11] + x[13];
            z[13] = x[12] + x[14];
            z[14] = x[13] + x[15];
            z[15] = x[14];
            z[16] = (M_SQRT2 * x[17]);
            z[17] = (M_SQRT2 * x[16]) + x[18];
            z[18] = x[17] + x[19];
            z[19] = x[18] + x[20];
            z[20] = x[19] + x[21];
            z[21] = x[20] + x[22];
            z[22] = x[21] + x[23];
            z[23] = x[22];
            z[24] = (M_SQRT2 * x[25]);
            z[25] = (M_SQRT2 * x[24]) + x[26];
            z[26] = x[25] + x[27];
            z[27] = x[26] + x[28];
            z[28] = x[27] + x[29];
            z[29] = x[28] + x[30];
            z[30] = x[29] + x[31];
            z[31] = x[30];
            z[32] = (M_SQRT2 * x[33]);
            z[33] = (M_SQRT2 * x[32]) + x[34];
            z[34] = x[33] + x[35];
            z[35] = x[34] + x[36];
            z[36] = x[35] + x[37];
            z[37] = x[36] + x[38];
            z[38] = x[37] + x[39];
            z[39] = x[38];
            z[40] = (M_SQRT2 * x[41]);
            z[41] = (M_SQRT2 * x[40]) + x[42];
            z[42] = x[41] + x[43];
            z[43] = x[42] + x[44];
            z[44] = x[43] + x[45];
            z[45] = x[44] + x[46];
            z[46] = x[45] + x[47];
            z[47] = x[46];
            z[48] = (M_SQRT2 * x[49]);
            z[49] = (M_SQRT2 * x[48]) + x[50];
            z[50] = x[49] + x[51];
            z[51] = x[50] + x[52];
            z[52] = x[51] + x[53];
            z[53] = x[52] + x[54];
            z[54] = x[53] + x[55];
            z[55] = x[54];
            z[56] = (M_SQRT2 * x[57]);
            z[57] = (M_SQRT2 * x[56]) + x[58];
            z[58] = x[57] + x[59];
            z[59] = x[58] + x[60];
            z[60] = x[59] + x[61];
            z[61] = x[60] + x[62];
            z[62] = x[61] + x[63];
            z[63] = x[62];
            break;
        case 2:
            z[ 0] = (M_SQRT2 * x[ 2]);
            z[ 1] = x[ 1] + x[ 3];
            z[ 2] = (M_SQRT2 * x[ 0]) + x[ 4];
            z[ 3] = x[ 1] + x[ 5];
            z[ 4] = x[ 2] + x[ 6];
            z[ 5] = x[ 3] + x[ 7];
            z[ 6] = x[ 4];
            z[ 7] = x[ 5] - x[ 7];
            z[ 8] = (M_SQRT2 * x[10]);
            z[ 9] = x[ 9] + x[11];
            z[10] = (M_SQRT2 * x[ 8]) + x[12];
            z[11] = x[ 9] + x[13];
            z[12] = x[10] + x[14];
            z[13] = x[11] + x[15];
            z[14] = x[12];
            z[15] = x[13] - x[15];
            z[16] = (M_SQRT2 * x[18]);
            z[17] = x[17] + x[19];
            z[18] = (M_SQRT2 * x[16]) + x[20];
            z[19] = x[17] + x[21];
            z[20] = x[18] + x[22];
            z[21] = x[19] + x[23];
            z[22] = x[20];
            z[23] = x[21] - x[23];
            z[24] = (M_SQRT2 * x[26]);
            z[25] = x[25] + x[27];
            z[26] = (M_SQRT2 * x[24]) + x[28];
            z[27] = x[25] + x[29];
            z[28] = x[26] + x[30];
            z[29] = x[27] + x[31];
            z[30] = x[28];
            z[31] = x[29] - x[31];
            z[32] = (M_SQRT2 * x[34]);
            z[33] = x[33] + x[35];
            z[34] = (M_SQRT2 * x[32]) + x[36];
            z[35] = x[33] + x[37];
            z[36] = x[34] + x[38];
            z[37] = x[35] + x[39];
            z[38] = x[36];
            z[39] = x[37] - x[39];
            z[40] = (M_SQRT2 * x[42]);
            z[41] = x[41] + x[43];
            z[42] = (M_SQRT2 * x[40]) + x[44];
            z[43] = x[41] + x[45];
            z[44] = x[42] + x[46];
            z[45] = x[43] + x[47];
            z[46] = x[44];
            z[47] = x[45] - x[47];
            z[48] = (M_SQRT2 * x[50]);
            z[49] = x[49] + x[51];
            z[50] = (M_SQRT2 * x[48]) + x[52];
            z[51] = x[49] + x[53];
            z[52] = x[50] + x[54];
            z[53] = x[51] + x[55];
            z[54] = x[52];
            z[55] = x[53] - x[55];
            z[56] = (M_SQRT2 * x[58]);
            z[57] = x[57] + x[59];
            z[58] = (M_SQRT2 * x[56]) + x[60];
            z[59] = x[57] + x[61];
            z[60] = x[58] + x[62];
            z[61] = x[59] + x[63];
            z[62] = x[60];
            z[63] = x[61] - x[63];
            break;
        case 3:
            z[ 0] = (M_SQRT2 * x[ 3]);
            z[ 1] = x[ 2] + x[ 4];
            z[ 2] = x[ 1] + x[ 5];
            z[ 3] = (M_SQRT2 * x[ 0]) + x[ 6];
            z[ 4] = x[ 1] + x[ 7];
            z[ 5] = x[ 2];
            z[ 6] = x[ 3] - x[ 7];
            z[ 7] = x[ 4] - x[ 6];
            z[ 8] = (M_SQRT2 * x[11]);
            z[ 9] = x[10] + x[12];
            z[10] = x[ 9] + x[13];
            z[11] = (M_SQRT2 * x[ 8]) + x[14];
            z[12] = x[ 9] + x[15];
            z[13] = x[10];
            z[14] = x[11] - x[15];
            z[15] = x[12] - x[14];
            z[16] = (M_SQRT2 * x[19]);
            z[17] = x[18] + x[20];
            z[18] = x[17] + x[21];
            z[19] = (M_SQRT2 * x[16]) + x[22];
            z[20] = x[17] + x[23];
            z[21] = x[18];
            z[22] = x[19] - x[23];
            z[23] = x[20] - x[22];
            z[24] = (M_SQRT2 * x[27]);
            z[25] = x[26] + x[28];
            z[26] = x[25] + x[29];
            z[27] = (M_SQRT2 * x[24]) + x[30];
            z[28] = x[25] + x[31];
            z[29] = x[26];
            z[30] = x[27] - x[31];
            z[31] = x[28] - x[30];
            z[32] = (M_SQRT2 * x[35]);
            z[33] = x[34] + x[36];
            z[34] = x[33] + x[37];
            z[35] = (M_SQRT2 * x[32]) + x[38];
            z[36] = x[33] + x[39];
            z[37] = x[34];
            z[38] = x[35] - x[39];
            z[39] = x[36] - x[38];
            z[40] = (M_SQRT2 * x[43]);
            z[41] = x[42] + x[44];
            z[42] = x[41] + x[45];
            z[43] = (M_SQRT2 * x[40]) + x[46];
            z[44] = x[41] + x[47];
            z[45] = x[42];
            z[46] = x[43] - x[47];
            z[47] = x[44] - x[46];
            z[48] = (M_SQRT2 * x[51]);
            z[49] = x[50] + x[52];
            z[50] = x[49] + x[53];
            z[51] = (M_SQRT2 * x[48]) + x[54];
            z[52] = x[49] + x[55];
            z[53] = x[50];
            z[54] = x[51] - x[55];
            z[55] = x[52] - x[54];
            z[56] = (M_SQRT2 * x[59]);
            z[57] = x[58] + x[60];
            z[58] = x[57] + x[61];
            z[59] = (M_SQRT2 * x[56]) + x[62];
            z[60] = x[57] + x[63];
            z[61] = x[58];
            z[62] = x[59] - x[63];
            z[63] = x[60] - x[62];
            break;
        case 4:
            z[ 0] = (M_SQRT2 * x[ 4]);
            z[ 1] = x[ 3] + x[ 5];
            z[ 2] = x[ 2] + x[ 6];
            z[ 3] = x[ 1] + x[ 7];
            z[ 4] = (M_SQRT2 * x[ 0]);
            z[ 5] = x[ 1] - x[ 7];
            z[ 6] = x[ 2] - x[ 6];
            z[ 7] = x[ 3] - x[ 5];
            z[ 8] = (M_SQRT2 * x[12]);
            z[ 9] = x[11] + x[13];
            z[10] = x[10] + x[14];
            z[11] = x[ 9] + x[15];
            z[12] = (M_SQRT2 * x[ 8]);
            z[13] = x[ 9] - x[15];
            z[14] = x[10] - x[14];
            z[15] = x[11] - x[13];
            z[16] = (M_SQRT2 * x[20]);
            z[17] = x[19] + x[21];
            z[18] = x[18] + x[22];
            z[19] = x[17] + x[23];
            z[20] = (M_SQRT2 * x[16]);
            z[21] = x[17] - x[23];
            z[22] = x[18] - x[22];
            z[23] = x[19] - x[21];
            z[24] = (M_SQRT2 * x[28]);
            z[25] = x[27] + x[29];
            z[26] = x[26] + x[30];
            z[27] = x[25] + x[31];
            z[28] = (M_SQRT2 * x[24]);
            z[29] = x[25] - x[31];
            z[30] = x[26] - x[30];
            z[31] = x[27] - x[29];
            z[32] = (M_SQRT2 * x[36]);
            z[33] = x[35] + x[37];
            z[34] = x[34] + x[38];
            z[35] = x[33] + x[39];
            z[36] = (M_SQRT2 * x[32]);
            z[37] = x[33] - x[39];
            z[38] = x[34] - x[38];
            z[39] = x[35] - x[37];
            z[40] = (M_SQRT2 * x[44]);
            z[41] = x[43] + x[45];
            z[42] = x[42] + x[46];
            z[43] = x[41] + x[47];
            z[44] = (M_SQRT2 * x[40]);
            z[45] = x[41] - x[47];
            z[46] = x[42] - x[46];
            z[47] = x[43] - x[45];
            z[48] = (M_SQRT2 * x[52]);
            z[49] = x[51] + x[53];
            z[50] = x[50] + x[54];
            z[51] = x[49] + x[55];
            z[52] = (M_SQRT2 * x[48]);
            z[53] = x[49] - x[55];
            z[54] = x[50] - x[54];
            z[55] = x[51] - x[53];
            z[56] = (M_SQRT2 * x[60]);
            z[57] = x[59] + x[61];
            z[58] = x[58] + x[62];
            z[59] = x[57] + x[63];
            z[60] = (M_SQRT2 * x[56]);
            z[61] = x[57] - x[63];
            z[62] = x[58] - x[62];
            z[63] = x[59] - x[61];
            break;
        case 5:
            z[ 0] = (M_SQRT2 * x[ 5]);
            z[ 1] = x[ 4] + x[ 6];
            z[ 2] = x[ 3] + x[ 7];
            z[ 3] = x[ 2];
            z[ 4] = x[ 1] - x[ 7];
            z[ 5] = (M_SQRT2 * x[ 0]) - x[ 6];
            z[ 6] = x[ 1] - x[ 5];
            z[ 7] = x[ 2] - x[ 4];
            z[ 8] = (M_SQRT2 * x[13]);
            z[ 9] = x[12] + x[14];
            z[10] = x[11] + x[15];
            z[11] = x[10];
            z[12] = x[ 9] - x[15];
            z[13] = (M_SQRT2 * x[ 8]) - x[14];
            z[14] = x[ 9] - x[13];
            z[15] = x[10] - x[12];
            z[16] = (M_SQRT2 * x[21]);
            z[17] = x[20] + x[22];
            z[18] = x[19] + x[23];
            z[19] = x[18];
            z[20] = x[17] - x[23];
            z[21] = (M_SQRT2 * x[16]) - x[22];
            z[22] = x[17] - x[21];
            z[23] = x[18] - x[20];
            z[24] = (M_SQRT2 * x[29]);
            z[25] = x[28] + x[30];
            z[26] = x[27] + x[31];
            z[27] = x[26];
            z[28] = x[25] - x[31];
            z[29] = (M_SQRT2 * x[24]) - x[30];
            z[30] = x[25] - x[29];
            z[31] = x[26] - x[28];
            z[32] = (M_SQRT2 * x[37]);
            z[33] = x[36] + x[38];
            z[34] = x[35] + x[39];
            z[35] = x[34];
            z[36] = x[33] - x[39];
            z[37] = (M_SQRT2 * x[32]) - x[38];
            z[38] = x[33] - x[37];
            z[39] = x[34] - x[36];
            z[40] = (M_SQRT2 * x[45]);
            z[41] = x[44] + x[46];
            z[42] = x[43] + x[47];
            z[43] = x[42];
            z[44] = x[41] - x[47];
            z[45] = (M_SQRT2 * x[40]) - x[46];
            z[46] = x[41] - x[45];
            z[47] = x[42] - x[44];
            z[48] = (M_SQRT2 * x[53]);
            z[49] = x[52] + x[54];
            z[50] = x[51] + x[55];
            z[51] = x[50];
            z[52] = x[49] - x[55];
            z[53] = (M_SQRT2 * x[48]) - x[54];
            z[54] = x[49] - x[53];
            z[55] = x[50] - x[52];
            z[56] = (M_SQRT2 * x[61]);
            z[57] = x[60] + x[62];
            z[58] = x[59] + x[63];
            z[59] = x[58];
            z[60] = x[57] - x[63];
            z[61] = (M_SQRT2 * x[56]) - x[62];
            z[62] = x[57] - x[61];
            z[63] = x[58] - x[60];
            break;
        case 6:
            z[ 0] = (M_SQRT2 * x[ 6]);
            z[ 1] = x[ 5] + x[ 7];
            z[ 2] = x[ 4];
            z[ 3] = x[ 3] - x[ 7];
            z[ 4] = x[ 2] - x[ 6];
            z[ 5] = x[ 1] - x[ 5];
            z[ 6] = (M_SQRT2 * x[ 0]) - x[ 4];
            z[ 7] = x[ 1] - x[ 3];
            z[ 8] = (M_SQRT2 * x[14]);
            z[ 9] = x[13] + x[15];
            z[10] = x[12];
            z[11] = x[11] - x[15];
            z[12] = x[10] - x[14];
            z[13] = x[ 9] - x[13];
            z[14] = (M_SQRT2 * x[ 8]) - x[12];
            z[15] = x[ 9] - x[11];
            z[16] = (M_SQRT2 * x[22]);
            z[17] = x[21] + x[23];
            z[18] = x[20];
            z[19] = x[19] - x[23];
            z[20] = x[18] - x[22];
            z[21] = x[17] - x[21];
            z[22] = (M_SQRT2 * x[16]) - x[20];
            z[23] = x[17] - x[19];
            z[24] = (M_SQRT2 * x[30]);
            z[25] = x[29] + x[31];
            z[26] = x[28];
            z[27] = x[27] - x[31];
            z[28] = x[26] - x[30];
            z[29] = x[25] - x[29];
            z[30] = (M_SQRT2 * x[24]) - x[28];
            z[31] = x[25] - x[27];
            z[32] = (M_SQRT2 * x[38]);
            z[33] = x[37] + x[39];
            z[34] = x[36];
            z[35] = x[35] - x[39];
            z[36] = x[34] - x[38];
            z[37] = x[33] - x[37];
            z[38] = (M_SQRT2 * x[32]) - x[36];
            z[39] = x[33] - x[35];
            z[40] = (M_SQRT2 * x[46]);
            z[41] = x[45] + x[47];
            z[42] = x[44];
            z[43] = x[43] - x[47];
            z[44] = x[42] - x[46];
            z[45] = x[41] - x[45];
            z[46] = (M_SQRT2 * x[40]) - x[44];
            z[47] = x[41] - x[43];
            z[48] = (M_SQRT2 * x[54]);
            z[49] = x[53] + x[55];
            z[50] = x[52];
            z[51] = x[51] - x[55];
            z[52] = x[50] - x[54];
            z[53] = x[49] - x[53];
            z[54] = (M_SQRT2 * x[48]) - x[52];
            z[55] = x[49] - x[51];
            z[56] = (M_SQRT2 * x[62]);
            z[57] = x[61] + x[63];
            z[58] = x[60];
            z[59] = x[59] - x[63];
            z[60] = x[58] - x[62];
            z[61] = x[57] - x[61];
            z[62] = (M_SQRT2 * x[56]) - x[60];
            z[63] = x[57] - x[59];
            break;
        case 7:
            z[ 0] = (M_SQRT2 * x[ 7]);
            z[ 1] = x[ 6];
            z[ 2] = x[ 5] - x[ 7];
            z[ 3] = x[ 4] - x[ 6];
            z[ 4] = x[ 3] - x[ 5];
            z[ 5] = x[ 2] - x[ 4];
            z[ 6] = x[ 1] - x[ 3];
            z[ 7] = (M_SQRT2 * x[ 0]) - x[ 2];
            z[ 8] = (M_SQRT2 * x[15]);
            z[ 9] = x[14];
            z[10] = x[13] - x[15];
            z[11] = x[12] - x[14];
            z[12] = x[11] - x[13];
            z[13] = x[10] - x[12];
            z[14] = x[ 9] - x[11];
            z[15] = (M_SQRT2 * x[ 8]) - x[10];
            z[16] = (M_SQRT2 * x[23]);
            z[17] = x[22];
            z[18] = x[21] - x[23];
            z[19] = x[20] - x[22];
            z[20] = x[19] - x[21];
            z[21] = x[18] - x[20];
            z[22] = x[17] - x[19];
            z[23] = (M_SQRT2 * x[16]) - x[18];
            z[24] = (M_SQRT2 * x[31]);
            z[25] = x[30];
            z[26] = x[29] - x[31];
            z[27] = x[28] - x[30];
            z[28] = x[27] - x[29];
            z[29] = x[26] - x[28];
            z[30] = x[25] - x[27];
            z[31] = (M_SQRT2 * x[24]) - x[26];
            z[32] = (M_SQRT2 * x[39]);
            z[33] = x[38];
            z[34] = x[37] - x[39];
            z[35] = x[36] - x[38];
            z[36] = x[35] - x[37];
            z[37] = x[34] - x[36];
            z[38] = x[33] - x[35];
            z[39] = (M_SQRT2 * x[32]) - x[34];
            z[40] = (M_SQRT2 * x[47]);
            z[41] = x[46];
            z[42] = x[45] - x[47];
            z[43] = x[44] - x[46];
            z[44] = x[43] - x[45];
            z[45] = x[42] - x[44];
            z[46] = x[41] - x[43];
            z[47] = (M_SQRT2 * x[40]) - x[42];
            z[48] = (M_SQRT2 * x[55]);
            z[49] = x[54];
            z[50] = x[53] - x[55];
            z[51] = x[52] - x[54];
            z[52] = x[51] - x[53];
            z[53] = x[50] - x[52];
            z[54] = x[49] - x[51];
            z[55] = (M_SQRT2 * x[48]) - x[50];
            z[56] = (M_SQRT2 * x[63]);
            z[57] = x[62];
            z[58] = x[61] - x[63];
            z[59] = x[60] - x[62];
            z[60] = x[59] - x[61];
            z[61] = x[58] - x[60];
            z[62] = x[57] - x[59];
            z[63] = (M_SQRT2 * x[56]) - x[58];
            break;
    }

    switch(k) {
        case 0:
            y[ 0] += ((2.0 * z[ 0])) * w;
            y[ 1] += ((2.0 * z[ 1])) * w;
            y[ 2] += ((2.0 * z[ 2])) * w;
            y[ 3] += ((2.0 * z[ 3])) * w;
            y[ 4] += ((2.0 * z[ 4])) * w;
            y[ 5] += ((2.0 * z[ 5])) * w;
            y[ 6] += ((2.0 * z[ 6])) * w;
            y[ 7] += ((2.0 * z[ 7])) * w;
            y[ 8] += ((2.0 * z[ 8])) * w;
            y[ 9] += ((2.0 * z[ 9])) * w;
            y[10] += ((2.0 * z[10])) * w;
            y[11] += ((2.0 * z[11])) * w;
            y[12] += ((2.0 * z[12])) * w;
            y[13] += ((2.0 * z[13])) * w;
            y[14] += ((2.0 * z[14])) * w;
            y[15] += ((2.0 * z[15])) * w;
            y[16] += ((2.0 * z[16])) * w;
            y[17] += ((2.0 * z[17])) * w;
            y[18] += ((2.0 * z[18])) * w;
            y[19] += ((2.0 * z[19])) * w;
            y[20] += ((2.0 * z[20])) * w;
            y[21] += ((2.0 * z[21])) * w;
            y[22] += ((2.0 * z[22])) * w;
            y[23] += ((2.0 * z[23])) * w;
            y[24] += ((2.0 * z[24])) * w;
            y[25] += ((2.0 * z[25])) * w;
            y[26] += ((2.0 * z[26])) * w;
            y[27] += ((2.0 * z[27])) * w;
            y[28] += ((2.0 * z[28])) * w;
            y[29] += ((2.0 * z[29])) * w;
            y[30] += ((2.0 * z[30])) * w;
            y[31] += ((2.0 * z[31])) * w;
            y[32] += ((2.0 * z[32])) * w;
            y[33] += ((2.0 * z[33])) * w;
            y[34] += ((2.0 * z[34])) * w;
            y[35] += ((2.0 * z[35])) * w;
            y[36] += ((2.0 * z[36])) * w;
            y[37] += ((2.0 * z[37])) * w;
            y[38] += ((2.0 * z[38])) * w;
            y[39] += ((2.0 * z[39])) * w;
            y[40] += ((2.0 * z[40])) * w;
            y[41] += ((2.0 * z[41])) * w;
            y[42] += ((2.0 * z[42])) * w;
            y[43] += ((2.0 * z[43])) * w;
            y[44] += ((2.0 * z[44])) * w;
            y[45] += ((2.0 * z[45])) * w;
            y[46] += ((2.0 * z[46])) * w;
            y[47] += ((2.0 * z[47])) * w;
            y[48] += ((2.0 * z[48])) * w;
            y[49] += ((2.0 * z[49])) * w;
            y[50] += ((2.0 * z[50])) * w;
            y[51] += ((2.0 * z[51])) * w;
            y[52] += ((2.0 * z[52])) * w;
            y[53] += ((2.0 * z[53])) * w;
            y[54] += ((2.0 * z[54])) * w;
            y[55] += ((2.0 * z[55])) * w;
            y[56] += ((2.0 * z[56])) * w;
            y[57] += ((2.0 * z[57])) * w;
            y[58] += ((2.0 * z[58])) * w;
            y[59] += ((2.0 * z[59])) * w;
            y[60] += ((2.0 * z[60])) * w;
            y[61] += ((2.0 * z[61])) * w;
            y[62] += ((2.0 * z[62])) * w;
            y[63] += ((2.0 * z[63])) * w;
            break;
        case 1:
            y[ 0] += ((M_SQRT2 * z[ 8])) * w;
            y[ 1] += ((M_SQRT2 * z[ 9])) * w;
            y[ 2] += ((M_SQRT2 * z[10])) * w;
            y[ 3] += ((M_SQRT2 * z[11])) * w;
            y[ 4] += ((M_SQRT2 * z[12])) * w;
            y[ 5] += ((M_SQRT2 * z[13])) * w;
            y[ 6] += ((M_SQRT2 * z[14])) * w;
            y[ 7] += ((M_SQRT2 * z[15])) * w;
            y[ 8] += ((M_SQRT2 * z[ 0]) + z[16]) * w;
            y[ 9] += ((M_SQRT2 * z[ 1]) + z[17]) * w;
            y[10] += ((M_SQRT2 * z[ 2]) + z[18]) * w;
            y[11] += ((M_SQRT2 * z[ 3]) + z[19]) * w;
            y[12] += ((M_SQRT2 * z[ 4]) + z[20]) * w;
            y[13] += ((M_SQRT2 * z[ 5]) + z[21]) * w;
            y[14] += ((M_SQRT2 * z[ 6]) + z[22]) * w;
            y[15] += ((M_SQRT2 * z[ 7]) + z[23]) * w;
            y[16] += (z[ 8] + z[24]) * w;
            y[17] += (z[ 9] + z[25]) * w;
            y[18] += (z[10] + z[26]) * w;
            y[19] += (z[11] + z[27]) * w;
            y[20] += (z[12] + z[28]) * w;
            y[21] += (z[13] + z[29]) * w;
            y[22] += (z[14] + z[30]) * w;
            y[23] += (z[15] + z[31]) * w;
            y[24] += (z[16] + z[32]) * w;
            y[25] += (z[17] + z[33]) * w;
            y[26] += (z[18] + z[34]) * w;
            y[27] += (z[19] + z[35]) * w;
            y[28] += (z[20] + z[36]) * w;
            y[29] += (z[21] + z[37]) * w;
            y[30] += (z[22] + z[38]) * w;
            y[31] += (z[23] + z[39]) * w;
            y[32] += (z[24] + z[40]) * w;
            y[33] += (z[25] + z[41]) * w;
            y[34] += (z[26] + z[42]) * w;
            y[35] += (z[27] + z[43]) * w;
            y[36] += (z[28] + z[44]) * w;
            y[37] += (z[29] + z[45]) * w;
            y[38] += (z[30] + z[46]) * w;
            y[39] += (z[31] + z[47]) * w;
            y[40] += (z[32] + z[48]) * w;
            y[41] += (z[33] + z[49]) * w;
            y[42] += (z[34] + z[50]) * w;
            y[43] += (z[35] + z[51]) * w;
            y[44] += (z[36] + z[52]) * w;
            y[45] += (z[37] + z[53]) * w;
            y[46] += (z[38] + z[54]) * w;
            y[47] += (z[39] + z[55]) * w;
            y[48] += (z[40] + z[56]) * w;
            y[49] += (z[41] + z[57]) * w;
            y[50] += (z[42] + z[58]) * w;
            y[51] += (z[43] + z[59]) * w;
            y[52] += (z[44] + z[60]) * w;
            y[53] += (z[45] + z[61]) * w;
            y[54] += (z[46] + z[62]) * w;
            y[55] += (z[47] + z[63]) * w;
            y[56] += (z[48]) * w;
            y[57] += (z[49]) * w;
            y[58] += (z[50]) * w;
            y[59] += (z[51]) * w;
            y[60] += (z[52]) * w;
            y[61] += (z[53]) * w;
            y[62] += (z[54]) * w;
            y[63] += (z[55]) * w;
            break;
        case 2:
            y[ 0] += ((M_SQRT2 * z[16])) * w;
            y[ 1] += ((M_SQRT2 * z[17])) * w;
            y[ 2] += ((M_SQRT2 * z[18])) * w;
            y[ 3] += ((M_SQRT2 * z[19])) * w;
            y[ 4] += ((M_SQRT2 * z[20])) * w;
            y[ 5] += ((M_SQRT2 * z[21])) * w;
            y[ 6] += ((M_SQRT2 * z[22])) * w;
            y[ 7] += ((M_SQRT2 * z[23])) * w;
            y[ 8] += (z[ 8] + z[24]) * w;
            y[ 9] += (z[ 9] + z[25]) * w;
            y[10] += (z[10] + z[26]) * w;
            y[11] += (z[11] + z[27]) * w;
            y[12] += (z[12] + z[28]) * w;
            y[13] += (z[13] + z[29]) * w;
            y[14] += (z[14] + z[30]) * w;
            y[15] += (z[15] + z[31]) * w;
            y[16] += ((M_SQRT2 * z[ 0]) + z[32]) * w;
            y[17] += ((M_SQRT2 * z[ 1]) + z[33]) * w;
            y[18] += ((M_SQRT2 * z[ 2]) + z[34]) * w;
            y[19] += ((M_SQRT2 * z[ 3]) + z[35]) * w;
            y[20] += ((M_SQRT2 * z[ 4]) + z[36]) * w;
            y[21] += ((M_SQRT2 * z[ 5]) + z[37]) * w;
            y[22] += ((M_SQRT2 * z[ 6]) + z[38]) * w;
            y[23] += ((M_SQRT2 * z[ 7]) + z[39]) * w;
            y[24] += (z[ 8] + z[40]) * w;
            y[25] += (z[ 9] + z[41]) * w;
            y[26] += (z[10] + z[42]) * w;
            y[27] += (z[11] + z[43]) * w;
            y[28] += (z[12] + z[44]) * w;
            y[29] += (z[13] + z[45]) * w;
            y[30] += (z[14] + z[46]) * w;
            y[31] += (z[15] + z[47]) * w;
            y[32] += (z[16] + z[48]) * w;
            y[33] += (z[17] + z[49]) * w;
            y[34] += (z[18] + z[50]) * w;
            y[35] += (z[19] + z[51]) * w;
            y[36] += (z[20] + z[52]) * w;
            y[37] += (z[21] + z[53]) * w;
            y[38] += (z[22] + z[54]) * w;
            y[39] += (z[23] + z[55]) * w;
            y[40] += (z[24] + z[56]) * w;
            y[41] += (z[25] + z[57]) * w;
            y[42] += (z[26] + z[58]) * w;
            y[43] += (z[27] + z[59]) * w;
            y[44] += (z[28] + z[60]) * w;
            y[45] += (z[29] + z[61]) * w;
            y[46] += (z[30] + z[62]) * w;
            y[47] += (z[31] + z[63]) * w;
            y[48] += (z[32]) * w;
            y[49] += (z[33]) * w;
            y[50] += (z[34]) * w;
            y[51] += (z[35]) * w;
            y[52] += (z[36]) * w;
            y[53] += (z[37]) * w;
            y[54] += (z[38]) * w;
            y[55] += (z[39]) * w;
            y[56] += (z[40] - z[56]) * w;
            y[57] += (z[41] - z[57]) * w;
            y[58] += (z[42] - z[58]) * w;
            y[59] += (z[43] - z[59]) * w;
            y[60] += (z[44] - z[60]) * w;
            y[61] += (z[45] - z[61]) * w;
            y[62] += (z[46] - z[62]) * w;
            y[63] += (z[47] - z[63]) * w;
            break;
        case 3:
            y[ 0] += ((M_SQRT2 * z[24])) * w;
            y[ 1] += ((M_SQRT2 * z[25])) * w;
            y[ 2] += ((M_SQRT2 * z[26])) * w;
            y[ 3] += ((M_SQRT2 * z[27])) * w;
            y[ 4] += ((M_SQRT2 * z[28])) * w;
            y[ 5] += ((M_SQRT2 * z[29])) * w;
            y[ 6] += ((M_SQRT2 * z[30])) * w;
            y[ 7] += ((M_SQRT2 * z[31])) * w;
            y[ 8] += (z[16] + z[32]) * w;
            y[ 9] += (z[17] + z[33]) * w;
            y[10] += (z[18] + z[34]) * w;
            y[11] += (z[19] + z[35]) * w;
            y[12] += (z[20] + z[36]) * w;
            y[13] += (z[21] + z[37]) * w;
            y[14] += (z[22] + z[38]) * w;
            y[15] += (z[23] + z[39]) * w;
            y[16] += (z[ 8] + z[40]) * w;
            y[17] += (z[ 9] + z[41]) * w;
            y[18] += (z[10] + z[42]) * w;
            y[19] += (z[11] + z[43]) * w;
            y[20] += (z[12] + z[44]) * w;
            y[21] += (z[13] + z[45]) * w;
            y[22] += (z[14] + z[46]) * w;
            y[23] += (z[15] + z[47]) * w;
            y[24] += ((M_SQRT2 * z[ 0]) + z[48]) * w;
            y[25] += ((M_SQRT2 * z[ 1]) + z[49]) * w;
            y[26] += ((M_SQRT2 * z[ 2]) + z[50]) * w;
            y[27] += ((M_SQRT2 * z[ 3]) + z[51]) * w;
            y[28] += ((M_SQRT2 * z[ 4]) + z[52]) * w;
            y[29] += ((M_SQRT2 * z[ 5]) + z[53]) * w;
            y[30] += ((M_SQRT2 * z[ 6]) + z[54]) * w;
            y[31] += ((M_SQRT2 * z[ 7]) + z[55]) * w;
            y[32] += (z[ 8] + z[56]) * w;
            y[33] += (z[ 9] + z[57]) * w;
            y[34] += (z[10] + z[58]) * w;
            y[35] += (z[11] + z[59]) * w;
            y[36] += (z[12] + z[60]) * w;
            y[37] += (z[13] + z[61]) * w;
            y[38] += (z[14] + z[62]) * w;
            y[39] += (z[15] + z[63]) * w;
            y[40] += (z[16]) * w;
            y[41] += (z[17]) * w;
            y[42] += (z[18]) * w;
            y[43] += (z[19]) * w;
            y[44] += (z[20]) * w;
            y[45] += (z[21]) * w;
            y[46] += (z[22]) * w;
            y[47] += (z[23]) * w;
            y[48] += (z[24] - z[56]) * w;
            y[49] += (z[25] - z[57]) * w;
            y[50] += (z[26] - z[58]) * w;
            y[51] += (z[27] - z[59]) * w;
            y[52] += (z[28] - z[60]) * w;
            y[53] += (z[29] - z[61]) * w;
            y[54] += (z[30] - z[62]) * w;
            y[55] += (z[31] - z[63]) * w;
            y[56] += (z[32] - z[48]) * w;
            y[57] += (z[33] - z[49]) * w;
            y[58] += (z[34] - z[50]) * w;
            y[59] += (z[35] - z[51]) * w;
            y[60] += (z[36] - z[52]) * w;
            y[61] += (z[37] - z[53]) * w;
            y[62] += (z[38] - z[54]) * w;
            y[63] += (z[39] - z[55]) * w;
            break;
        case 4:
            y[ 0] += ((M_SQRT2 * z[32])) * w;
            y[ 1] += ((M_SQRT2 * z[33])) * w;
            y[ 2] += ((M_SQRT2 * z[34])) * w;
            y[ 3] += ((M_SQRT2 * z[35])) * w;
            y[ 4] += ((M_SQRT2 * z[36])) * w;
            y[ 5] += ((M_SQRT2 * z[37])) * w;
            y[ 6] += ((M_SQRT2 * z[38])) * w;
            y[ 7] += ((M_SQRT2 * z[39])) * w;
            y[ 8] += (z[24] + z[40]) * w;
            y[ 9] += (z[25] + z[41]) * w;
            y[10] += (z[26] + z[42]) * w;
            y[11] += (z[27] + z[43]) * w;
            y[12] += (z[28] + z[44]) * w;
            y[13] += (z[29] + z[45]) * w;
            y[14] += (z[30] + z[46]) * w;
            y[15] += (z[31] + z[47]) * w;
            y[16] += (z[16] + z[48]) * w;
            y[17] += (z[17] + z[49]) * w;
            y[18] += (z[18] + z[50]) * w;
            y[19] += (z[19] + z[51]) * w;
            y[20] += (z[20] + z[52]) * w;
            y[21] += (z[21] + z[53]) * w;
            y[22] += (z[22] + z[54]) * w;
            y[23] += (z[23] + z[55]) * w;
            y[24] += (z[ 8] + z[56]) * w;
            y[25] += (z[ 9] + z[57]) * w;
            y[26] += (z[10] + z[58]) * w;
            y[27] += (z[11] + z[59]) * w;
            y[28] += (z[12] + z[60]) * w;
            y[29] += (z[13] + z[61]) * w;
            y[30] += (z[14] + z[62]) * w;
            y[31] += (z[15] + z[63]) * w;
            y[32] += ((M_SQRT2 * z[ 0])) * w;
            y[33] += ((M_SQRT2 * z[ 1])) * w;
            y[34] += ((M_SQRT2 * z[ 2])) * w;
            y[35] += ((M_SQRT2 * z[ 3])) * w;
            y[36] += ((M_SQRT2 * z[ 4])) * w;
            y[37] += ((M_SQRT2 * z[ 5])) * w;
            y[38] += ((M_SQRT2 * z[ 6])) * w;
            y[39] += ((M_SQRT2 * z[ 7])) * w;
            y[40] += (z[ 8] - z[56]) * w;
            y[41] += (z[ 9] - z[57]) * w;
            y[42] += (z[10] - z[58]) * w;
            y[43] += (z[11] - z[59]) * w;
            y[44] += (z[12] - z[60]) * w;
            y[45] += (z[13] - z[61]) * w;
            y[46] += (z[14] - z[62]) * w;
            y[47] += (z[15] - z[63]) * w;
            y[48] += (z[16] - z[48]) * w;
            y[49] += (z[17] - z[49]) * w;
            y[50] += (z[18] - z[50]) * w;
            y[51] += (z[19] - z[51]) * w;
            y[52] += (z[20] - z[52]) * w;
            y[53] += (z[21] - z[53]) * w;
            y[54] += (z[22] - z[54]) * w;
            y[55] += (z[23] - z[55]) * w;
            y[56] += (z[24] - z[40]) * w;
            y[57] += (z[25] - z[41]) * w;
            y[58] += (z[26] - z[42]) * w;
            y[59] += (z[27] - z[43]) * w;
            y[60] += (z[28] - z[44]) * w;
            y[61] += (z[29] - z[45]) * w;
            y[62] += (z[30] - z[46]) * w;
            y[63] += (z[31] - z[47]) * w;
            break;
        case 5:
            y[ 0] += ((M_SQRT2 * z[40])) * w;
            y[ 1] += ((M_SQRT2 * z[41])) * w;
            y[ 2] += ((M_SQRT2 * z[42])) * w;
            y[ 3] += ((M_SQRT2 * z[43])) * w;
            y[ 4] += ((M_SQRT2 * z[44])) * w;
            y[ 5] += ((M_SQRT2 * z[45])) * w;
            y[ 6] += ((M_SQRT2 * z[46])) * w;
            y[ 7] += ((M_SQRT2 * z[47])) * w;
            y[ 8] += (z[32] + z[48]) * w;
            y[ 9] += (z[33] + z[49]) * w;
            y[10] += (z[34] + z[50]) * w;
            y[11] += (z[35] + z[51]) * w;
            y[12] += (z[36] + z[52]) * w;
            y[13] += (z[37] + z[53]) * w;
            y[14] += (z[38] + z[54]) * w;
            y[15] += (z[39] + z[55]) * w;
            y[16] += (z[24] + z[56]) * w;
            y[17] += (z[25] + z[57]) * w;
            y[18] += (z[26] + z[58]) * w;
            y[19] += (z[27] + z[59]) * w;
            y[20] += (z[28] + z[60]) * w;
            y[21] += (z[29] + z[61]) * w;
            y[22] += (z[30] + z[62]) * w;
            y[23] += (z[31] + z[63]) * w;
            y[24] += (z[16]) * w;
            y[25] += (z[17]) * w;
            y[26] += (z[18]) * w;
            y[27] += (z[19]) * w;
            y[28] += (z[20]) * w;
            y[29] += (z[21]) * w;
            y[30] += (z[22]) * w;
            y[31] += (z[23]) * w;
            y[32] += (z[ 8] - z[56]) * w;
            y[33] += (z[ 9] - z[57]) * w;
            y[34] += (z[10] - z[58]) * w;
            y[35] += (z[11] - z[59]) * w;
            y[36] += (z[12] - z[60]) * w;
            y[37] += (z[13] - z[61]) * w;
            y[38] += (z[14] - z[62]) * w;
            y[39] += (z[15] - z[63]) * w;
            y[40] += ((M_SQRT2 * z[ 0]) - z[48]) * w;
            y[41] += ((M_SQRT2 * z[ 1]) - z[49]) * w;
            y[42] += ((M_SQRT2 * z[ 2]) - z[50]) * w;
            y[43] += ((M_SQRT2 * z[ 3]) - z[51]) * w;
            y[44] += ((M_SQRT2 * z[ 4]) - z[52]) * w;
            y[45] += ((M_SQRT2 * z[ 5]) - z[53]) * w;
            y[46] += ((M_SQRT2 * z[ 6]) - z[54]) * w;
            y[47] += ((M_SQRT2 * z[ 7]) - z[55]) * w;
            y[48] += (z[ 8] - z[40]) * w;
            y[49] += (z[ 9] - z[41]) * w;
            y[50] += (z[10] - z[42]) * w;
            y[51] += (z[11] - z[43]) * w;
            y[52] += (z[12] - z[44]) * w;
            y[53] += (z[13] - z[45]) * w;
            y[54] += (z[14] - z[46]) * w;
            y[55] += (z[15] - z[47]) * w;
            y[56] += (z[16] - z[32]) * w;
            y[57] += (z[17] - z[33]) * w;
            y[58] += (z[18] - z[34]) * w;
            y[59] += (z[19] - z[35]) * w;
            y[60] += (z[20] - z[36]) * w;
            y[61] += (z[21] - z[37]) * w;
            y[62] += (z[22] - z[38]) * w;
            y[63] += (z[23] - z[39]) * w;
            break;
        case 6:
            y[ 0] += ((M_SQRT2 * z[48])) * w;
            y[ 1] += ((M_SQRT2 * z[49])) * w;
            y[ 2] += ((M_SQRT2 * z[50])) * w;
            y[ 3] += ((M_SQRT2 * z[51])) * w;
            y[ 4] += ((M_SQRT2 * z[52])) * w;
            y[ 5] += ((M_SQRT2 * z[53])) * w;
            y[ 6] += ((M_SQRT2 * z[54])) * w;
            y[ 7] += ((M_SQRT2 * z[55])) * w;
            y[ 8] += (z[40] + z[56]) * w;
            y[ 9] += (z[41] + z[57]) * w;
            y[10] += (z[42] + z[58]) * w;
            y[11] += (z[43] + z[59]) * w;
            y[12] += (z[44] + z[60]) * w;
            y[13] += (z[45] + z[61]) * w;
            y[14] += (z[46] + z[62]) * w;
            y[15] += (z[47] + z[63]) * w;
            y[16] += (z[32]) * w;
            y[17] += (z[33]) * w;
            y[18] += (z[34]) * w;
            y[19] += (z[35]) * w;
            y[20] += (z[36]) * w;
            y[21] += (z[37]) * w;
            y[22] += (z[38]) * w;
            y[23] += (z[39]) * w;
            y[24] += (z[24] - z[56]) * w;
            y[25] += (z[25] - z[57]) * w;
            y[26] += (z[26] - z[58]) * w;
            y[27] += (z[27] - z[59]) * w;
            y[28] += (z[28] - z[60]) * w;
            y[29] += (z[29] - z[61]) * w;
            y[30] += (z[30] - z[62]) * w;
            y[31] += (z[31] - z[63]) * w;
            y[32] += (z[16] - z[48]) * w;
            y[33] += (z[17] - z[49]) * w;
            y[34] += (z[18] - z[50]) * w;
            y[35] += (z[19] - z[51]) * w;
            y[36] += (z[20] - z[52]) * w;
            y[37] += (z[21] - z[53]) * w;
            y[38] += (z[22] - z[54]) * w;
            y[39] += (z[23] - z[55]) * w;
            y[40] += (z[ 8] - z[40]) * w;
            y[41] += (z[ 9] - z[41]) * w;
            y[42] += (z[10] - z[42]) * w;
            y[43] += (z[11] - z[43]) * w;
            y[44] += (z[12] - z[44]) * w;
            y[45] += (z[13] - z[45]) * w;
            y[46] += (z[14] - z[46]) * w;
            y[47] += (z[15] - z[47]) * w;
            y[48] += ((M_SQRT2 * z[ 0]) - z[32]) * w;
            y[49] += ((M_SQRT2 * z[ 1]) - z[33]) * w;
            y[50] += ((M_SQRT2 * z[ 2]) - z[34]) * w;
            y[51] += ((M_SQRT2 * z[ 3]) - z[35]) * w;
            y[52] += ((M_SQRT2 * z[ 4]) - z[36]) * w;
            y[53] += ((M_SQRT2 * z[ 5]) - z[37]) * w;
            y[54] += ((M_SQRT2 * z[ 6]) - z[38]) * w;
            y[55] += ((M_SQRT2 * z[ 7]) - z[39]) * w;
            y[56] += (z[ 8] - z[24]) * w;
            y[57] += (z[ 9] - z[25]) * w;
            y[58] += (z[10] - z[26]) * w;
            y[59] += (z[11] - z[27]) * w;
            y[60] += (z[12] - z[28]) * w;
            y[61] += (z[13] - z[29]) * w;
            y[62] += (z[14] - z[30]) * w;
            y[63] += (z[15] - z[31]) * w;
            break;
        case 7:
            y[ 0] += ((M_SQRT2 * z[56])) * w;
            y[ 1] += ((M_SQRT2 * z[57])) * w;
            y[ 2] += ((M_SQRT2 * z[58])) * w;
            y[ 3] += ((M_SQRT2 * z[59])) * w;
            y[ 4] += ((M_SQRT2 * z[60])) * w;
            y[ 5] += ((M_SQRT2 * z[61])) * w;
            y[ 6] += ((M_SQRT2 * z[62])) * w;
            y[ 7] += ((M_SQRT2 * z[63])) * w;
            y[ 8] += (z[48]) * w;
            y[ 9] += (z[49]) * w;
            y[10] += (z[50]) * w;
            y[11] += (z[51]) * w;
            y[12] += (z[52]) * w;
            y[13] += (z[53]) * w;
            y[14] += (z[54]) * w;
            y[15] += (z[55]) * w;
            y[16] += (z[40] - z[56]) * w;
            y[17] += (z[41] - z[57]) * w;
            y[18] += (z[42] - z[58]) * w;
            y[19] += (z[43] - z[59]) * w;
            y[20] += (z[44] - z[60]) * w;
            y[21] += (z[45] - z[61]) * w;
            y[22] += (z[46] - z[62]) * w;
            y[23] += (z[47] - z[63]) * w;
            y[24] += (z[32] - z[48]) * w;
            y[25] += (z[33] - z[49]) * w;
            y[26] += (z[34] - z[50]) * w;
            y[27] += (z[35] - z[51]) * w;
            y[28] += (z[36] - z[52]) * w;
            y[29] += (z[37] - z[53]) * w;
            y[30] += (z[38] - z[54]) * w;
            y[31] += (z[39] - z[55]) * w;
            y[32] += (z[24] - z[40]) * w;
            y[33] += (z[25] - z[41]) * w;
            y[34] += (z[26] - z[42]) * w;
            y[35] += (z[27] - z[43]) * w;
            y[36] += (z[28] - z[44]) * w;
            y[37] += (z[29] - z[45]) * w;
            y[38] += (z[30] - z[46]) * w;
            y[39] += (z[31] - z[47]) * w;
            y[40] += (z[16] - z[32]) * w;
            y[41] += (z[17] - z[33]) * w;
            y[42] += (z[18] - z[34]) * w;
            y[43] += (z[19] - z[35]) * w;
            y[44] += (z[20] - z[36]) * w;
            y[45] += (z[21] - z[37]) * w;
            y[46] += (z[22] - z[38]) * w;
            y[47] += (z[23] - z[39]) * w;
            y[48] += (z[ 8] - z[24]) * w;
            y[49] += (z[ 9] - z[25]) * w;
            y[50] += (z[10] - z[26]) * w;
            y[51] += (z[11] - z[27]) * w;
            y[52] += (z[12] - z[28]) * w;
            y[53] += (z[13] - z[29]) * w;
            y[54] += (z[14] - z[30]) * w;
            y[55] += (z[15] - z[31]) * w;
            y[56] += ((M_SQRT2 * z[ 0]) - z[16]) * w;
            y[57] += ((M_SQRT2 * z[ 1]) - z[17]) * w;
            y[58] += ((M_SQRT2 * z[ 2]) - z[18]) * w;
            y[59] += ((M_SQRT2 * z[ 3]) - z[19]) * w;
            y[60] += ((M_SQRT2 * z[ 4]) - z[20]) * w;
            y[61] += ((M_SQRT2 * z[ 5]) - z[21]) * w;
            y[62] += ((M_SQRT2 * z[ 6]) - z[22]) * w;
            y[63] += ((M_SQRT2 * z[ 7]) - z[23]) * w;
            break;
    }

    return;
}
